/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: TestService
 * Author:   Administrator
 * Date:     2019/6/17 17:12
 * Description: TestService
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.lumacong.websocket.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.stereotype.Service;

import java.sql.PreparedStatement;
import java.sql.SQLException;

@Service
public class DsPrizeUserService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public boolean insertByStatement(String logId,String wordsResultNum,String imgUrl,String wordsResult) {
        String sql = "insert into dou_screen_capture(log_id, words_result_num, img_url, words_result, sys_user_id, created_at) values (?,?,?,?,1,now())";
        return jdbcTemplate.update(sql, new PreparedStatementSetter() {
            @Override
            public void setValues(PreparedStatement preparedStatement) throws SQLException {
                preparedStatement.setString(1, logId);
                preparedStatement.setString(2, wordsResultNum);
                preparedStatement.setString(3, imgUrl);
                preparedStatement.setString(4, wordsResult);
            }
        }) > 0;
    }


}
